#include "timerimpl.h"

CTimerImpl::CTimerImpl()
{
	
}
CTimerImpl::~CTimerImpl(void)
{
	logi("CTimerImpl::~CTimerImpl");
}
std_method_impl CTimerImpl::Start()
{
	return (S_SUCCESS == this->time_start()) ? S_OK : E_FAIL;
}
std_method_impl CTimerImpl::Stop()
{
	return (S_SUCCESS == this->time_stop()) ? S_OK : E_FAIL;
}
std_method_impl CTimerImpl::SetSec(int isec)
{
	return (S_SUCCESS == this->time_sec(isec)) ? S_OK : E_FAIL;
}
std_method_impl CTimerImpl::UnBind()
{
	rc_assert(m_Event != NULL, E_FAIL)
	m_Event.dispose();
	return S_OK;
}
std_method_impl CTimerImpl::Bind(IBase* pBase)
{
	rc_assert(pBase != NULL, E_FAIL)
	return pBase->QueryInterface(IID_ITimerEvent, (void**)&m_Event);
}
std_method_type_impl(UINT) CTimerImpl::GetId()
{
	return m_uId;
}
std_method_impl CTimerImpl::SetId(UINT uId)
{
	m_uId = uId;
	return S_OK;
}
int CTimerImpl::OnTime(UINT err)
{
	rc_assert(m_Event, S_ERROR)
	return m_Event->OnTimer(m_uId, err) == S_OK ? S_SUCCESS : S_ERROR;
}

